<!-- 修改角色 -->
<template>
  <div>
    <!-- <el-dialog
      :close-on-click-modal="false"
      title="创建角色"
      :visible.sync="editDialog"
      width="30%"
      :before-close="handleClose"
      size="mini"
    > -->
    <el-drawer title="修改角色" :visible.sync="editDialog" @close="handleClose">
      <el-form ref="roleForm" :model="roleForm" label-width="80px" size="mini">
        <el-form-item label="角色名称">
          <el-input v-model="roleForm.name"></el-input>
        </el-form-item>
        <el-form-item label="授权标识">
          <el-input v-model="roleForm.auth"></el-input>
        </el-form-item>
        <el-form-item label="类型">
          <el-select
            v-model="roleForm.type"
            placeholder="请选择"
            style="width: 100%"
          >
            <el-option
              v-for="item in types"
              :key="item.code"
              :label="item.remark"
              :value="item.code"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="级别">
          <el-input-number
            v-model="roleForm.level"
            :min="0"
            :max="99"
          ></el-input-number>
        </el-form-item>
        <el-form-item label="是否启用">
          <el-radio-group v-model="roleForm.enable">
            <el-radio
              v-for="item in enables"
              :key="item.code"
              :label="item.code"
              >{{ item.remark }}</el-radio
            >
          </el-radio-group>
        </el-form-item>

        <el-form-item label="备注">
          <el-input type="textarea" v-model="roleForm.remark"></el-input>
        </el-form-item>
        <el-form-item>
          <!-- @click="handleAddSubmit" -->
          <el-button type="primary" size="mini">确定</el-button>
          <!-- @click="handleResetRoleForm" -->
          <el-button size="mini">重置</el-button>
        </el-form-item>
      </el-form>
    </el-drawer>
    <!-- </el-dialog> -->
  </div>
</template>

<script>
export default {
  props: {
    data: {
      type: Object,
    },
    apiPerms: {
      type: Array,
    },
    dataPerms: {
      type: Array,
    },
    perms: {
      type: Array,
    },
    parents: {
      type: Array,
    },
    types: {
      type: Array,
    },
    entities: {
      type: Array,
    },
    enables: {
      type: Array,
    },
  },
  name: "",
  data() {
    return {
      editDialog: true,
      roleForm: {},
    };
  },
  created() {
    this.roleForm = this.data;
  },
  mounted() {},
  methods: {
    /**
     * 提交修改
     */
    handleEditSubmit() {
      this.$emit("submit", this.roleForm);
    },
    handleClose() {
      this.roleForm = {};
      this.$emit("close");
    },
  },
};
</script>

<style scoped>
/* @import url(); 引入css类 */
.el-form {
  padding-right: 10px;
}
</style>
